/***************************************************************************
 * Copyright (C) 2012
 * by Dj_Skual
 *
 * Original ListBrowser by Tantric (C) 2009
 *
 * This software is provided 'as-is', without any express or implied
 * warranty. In no event will the authors be held liable for any
 * damages arising from the use of this software.
 *
 * Permission is granted to anyone to use this software for any
 * purpose, including commercial applications, and to alter it and
 * redistribute it freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you
 * must not claim that you wrote the original software. If you use
 * this software in a product, an acknowledgment in the product
 * documentation would be appreciated but is not required.
 *
 * 2. Altered source versions must be plainly marked as such, and
 * must not be misrepresented as being the original software.
 *
 * 3. This notice may not be removed or altered from any source
 * distribution.
 *
 * for SaveGame Manager GX 2012
 ***************************************************************************/
#ifndef __LISTMIIBROWSER_HPP_
#define __LISTMIIBROWSER_HPP_

#include "ListMiiInfos.h"
#include "../GuiFileBrowser.hpp"
#include "../../Controls/Scrollbar.hpp"

class ListMiiBrowser : public GuiFileBrowser, public sigslot::has_slots<>
{
	public:
		ListMiiBrowser(Browser * miibrowser, int w, int h);
		virtual ~ListMiiBrowser();
		
		void SetListRumble();
		void Update(GuiTrigger * t);
		
	protected:
		void AddButton();
		void RemoveButton(int i);
		
		void OnBrowserIndexChange();
		void OnBrowserListChange();
		void OnVisibleChange(GuiElement *sender, bool Visible);
		void OnButtonStateChange(GuiElement *sender, int state, int stateChan);
		void OnListChange(int selItem, int selIndex);
		void OnClicked(GuiButton *sender, int pointer, const POINT &p);
		
		int selectedItem;
		int pageIndex;
		int numEntries;
		int PageSize;
		bool forceReload;
		
		std::vector<GuiText *> fileBtnText;
		std::vector<GuiText *> fileBtnTextOver;
		std::vector<GuiImage *> fileSelectionImg;
		std::vector<GuiImage *> fileBtnIcon;
		std::vector<GuiButton *> fileBtn;
		
		Scrollbar * scrollbar;
		MiiInfosWindow * infosWindow;
		
		GuiImageData * bgFileSelection;
		GuiImageData * separator;
		GuiImageData * fileMii;
		
		GuiImage * separatorImg;
		
		GuiSound * btnSoundClick;
		
		GuiTrigger * trigA;
};

#endif
